<?php
class Ajax extends MY_Controller{
    function __construct() {
        parent ::__construct();
        $this->load->library('pager');
        $this->load->model('mabout');
        $this->load->model('mtour');
        $this->load->model('mhotel');
        $this->load->model('mholiday');
        $this->load->model('model_tours');
        $this->load->helper('main_helper');
        $this->load->model('mtype');
        $this->load->model('model_region');
    }
    function list_tour($listtours, $listpage) {
        if(isset($listtours)) {
            foreach($listtours as $tours){
             	echo '<div class="tours">';   
					echo '<div class="toursl">';
						echo "<a href='".base_url()."tours/".$tours['tours_rewrite']."-".$tours['tours_id'].".html'><img src='".base_url()."uploads/tours/thumb/".$tours['tours_image']."' class='tourimg' alt='".$tours['tours_title']."' title='".$tours['tours_title']."' /></a>";
					echo "</div>";
					echo '<div class="toursr">';
						echo "<h3><a href='".base_url()."tours/".$tours['tours_rewrite']."-".$tours['tours_id'].".html' title='".$tours['tours_title']."'>".$tours['tours_title']."</a></h3>";
						echo "<p class='tourp'>Duration: ".$tours['tours_type']."</p>";
						echo "<p class='tourpri'>Price from : <strong class='tourstr'>$".$tours['tours_price']."</strong></p>";
						echo "<p><span class='spangra'>Grade : </span>";
						$typeimage = $this->mtype->get_data($tours['type_id']);
						for($i=0; $i<$tours['tours_star']; $i++){
							echo "<img src='".base_url()."uploads/holiday/".$typeimage['icon']."' class='grare' alt='' />";
						}
						for($j=0; $j<5-$i;$j++){
							echo "<img src='".base_url()."uploads/holiday/".$typeimage['icon2']."' class='grare' alt='' />";
						}
						echo "</p>";
						echo "<div class='cls'></div>";
						echo "<div class='tourino'>".CutStr($tours['tours_short_info'],100,true)."<br /><a class='acomment' href='".base_url()."tours/".$tours['tours_rewrite']."-".$tours['tours_id'].".html'>More Details ...</a></div>";
					echo "</div>";
					echo '<div class="cls"></div>';
				echo "</div>";
			}
			echo "<div id='pagina'>".$listpage."</div>";
        }

    }
    public function about() {
        $start = $this->input->post("start");
        $type = $this->input->post("cate");
        $limit = 7;
        $total = $this->mabout->count_status();
        $pages = $this->pager->page($total,$limit);
        $listpage  = $this->pager->listpages($pages,$start,$limit,$type);
        $abouts = $this->mabout->get_by_cate($type,$limit,$start);
        echo "<div id='abr' class='fl w640'>";
        echo "<h3 class='item mgt20 mgb3 red f17'>WELCOME TO WLINK TRAVEL</h3>";
        echo "<P class='lheight17 bold'>Indochina is the former name of a region of Southeast Asia, which comprises the territories of Vietnam, Laos, Cambodia, Myanmar and Thailand. Rediscovering Indochina is currently a unique concept in Indochina travel products. It is designed to foster and generate return visits by enticing clients to come again for a truly new Indochina experience. </P>";
        echo "<h3 class='item mgt25 mgb3 red f17'>MEET OUR TEAM</h3>";
        if(isset($abouts)) {
            foreach($abouts as $item) {
                echo "<div class='item pdb20 pdt20 bder_t1_d5'>";
                echo "<img width='133' height='93' class='fl bder_rdus3' src='".base_url()."uploads/about/thumb/". $item['image']."'/>";
                echo "<div class='fl pdl17 w292'>";
                echo "<p class='gray f13 mgt0 mgb0'><strong class='red'>".$item['name']."</strong> - ".$item['position']."</p>";
                echo "<p class='gray mgb0 fl mgt8 f11 lheight17'>".CutStr($item['content'], 150)."</p>";
                echo "</div>";
                echo "<div class='fr w165'>";
                echo "<p class='gray f13 mgt0 mgb0'>".$item['country']."</p>";
                echo "<p class='gray mgb0 fl mgt8 f11 lheight17'>".CutStr($item['description'],150)."</p>";
                echo "</div>";
            echo "</div>";
             }
        echo "<div id='pagination' >".$listpage."</div>";
        }

        echo "</div>";
    }
    public function holiday() {
        $start = $this->input->post("start");
        $type = $this->input->post("type");
        $limit = 7;
        $total = $this->mtour->count_type($type);
        $pages = $this->pager->page($total,$limit);
        $listpage  = $this->pager->listpagehotel($pages,$start,$limit,$type);
        $holidays = $this->mtour->get_type($type,$limit,$start);
		$this->load->view("public/cut_str");
		if(isset($holidays) && $holidays != NULL){
        foreach($holidays as $tours){ ?>
            <div class="tours">
                <div class="toursl">
                    <a href="<?php echo base_url()."tours/".$tours['tours_rewrite']."-".$tours['tours_id']; ?>.html"><img src="<?php echo base_url()."uploads/tours/thumb/".$tours['tours_image']; ?>" class="tourimg" alt="<?php echo $tours['tours_title']; ?>" title="<?php echo $tours['tours_title']; ?>" /></a>
                </div>
                <div class="toursr">
                    <h3><a href="<?php echo base_url()."tours/".$tours['tours_rewrite']."-".$tours['tours_id']; ?>.html" title="<?php echo $tours['tours_title']; ?>"><?php echo $tours['tours_title']; ?></a></h3>
                    <p class="tourp">Duration: <?php echo $tours['tours_type']; ?></p>
                    <p class="tourpri">Price from : <strong class="tourstr">$<?php echo $tours['tours_price']; ?></strong></p>
                    <p><span class="spangra">Grade : </span>
                    <?php
                    $typeimage = $this->mtype->get_data($tours['type_id']);
                    for($i=0; $i<$tours['tours_star']; $i++){
                    ?>
                        <img src="<?php echo base_url(); ?>uploads/holiday/<?php echo $typeimage['icon']; ?>" class="grare" alt="" />
                    <?php }?>
                    <?php for($j=0; $j<5-$i;$j++){ ?>
                        <img src="<?php echo base_url(); ?>uploads/holiday/<?php echo $typeimage['icon2'];?>" class="grare" alt="" />
                    <?php }?>
                    </p>
                    <div class="cls"></div>
                    <div class="tourino"><?php echo cut_str($tours['tours_short_info'],0,100); ?><br /><a class="acomment" href="<?php echo base_url()."tours/".$tours['tours_rewrite']."-".$tours['tours_id']; ?>.html">More Details ...</a></div>
                </div>
            </div>
            <div class="cls"></div>
        <?php } } ?>
        <?php
        echo '<div class="pagina">';
            echo $listpage;
        echo "</div>";
    }
    public function hotel() {
        $destina_id = $this->input->post('destina_id');
        $start = 0;
        $limit = 10;
        $total = $this->mhotel->count_hotel_d($destina_id);
        $pages = $this->pager->page($total,$limit);
        $listpage  = $this->pager->listpagehotel($pages,$start,$limit,$destina_id);
        $hotels = $this->mhotel->get_hotel_d($destina_id, $limit, $start);
        echo "<div class='hotabc'>";
		if(isset($hotels)) {
		$i =0;
		foreach($hotels as $item) {
			$name = strtolower($item['hotel_name']);
			$name = str_replace("'","",$item['hotel_name'],$name);
			$name = str_replace("&",'',$item['hotel_name'],$name);
			$url = str_replace(' ', '-', $name);
			?>
		<div class="places">
			<div class="placel">
				<a href="<?php echo base_url(); ?>hotel/<?php echo $url; ?>-<?php echo $item['id']; ?>.html"><img src="<?php echo base_url(); ?>uploads/hotel/<?php echo $item['hotel_thumb']; ?>" class="placeimg"/></a>
			</div>
			<div class="placer">
				<h3><a href="<?php echo base_url(); ?>hotel/<?php echo $url; ?>-<?php echo $item['id']; ?>.html"><?php echo CutStr($item['hotel_name'],23,false); ?></a></h3>
				<div class="hotstar">
					<div class="stars"><div class="star_active" style="width:<?php echo ($item['hotel_star']*12).'px'?>;"></div></div>
				</div>
				<div class="plainfo">
					<span><?php echo CutStr(strip_tags($item['hotel_title']),110); ?></span>
					<a href="<?php echo base_url(); ?>hotel/<?php echo $url; ?>-<?php echo $item['id']; ?>.html" class="red bold mgt5 fl">More details &raquo;</a>
				</div>
			</div>
		</div>
		<?php $i++; }}
		echo "<div class='cls'>";
		echo "<div class='pagina'>";
		echo $listpage;
		echo "</div>";
		echo "</div>";
		echo "</div>";
    }
    public function page_hotel() {
        $destina_id = $this->input->post('type');
        $start = $this->input->post('start');
        $limit = 10;
        $total = $this->mhotel->count_hotel_d($destina_id);
        $pages = $this->pager->page($total,$limit);
        $listpage  = $this->pager->listpagehotel($pages,$start,$limit,$destina_id);
        $hotels = $this->mhotel->get_hotel_d($destina_id, $limit, $start);
        echo "<div class='hotabc'>";
		if(isset($hotels)) {
		$i =0;
		foreach($hotels as $item) {
			$name = strtolower($item['hotel_name']);
			$name = str_replace("'","",$item['hotel_name'],$name);
			$name = str_replace("&",'',$item['hotel_name'],$name);
			$url = str_replace(' ', '-', $name);
			?>
		<div class="places">
			<div class="placel">
				<a href="<?php echo base_url(); ?>hotel/<?php echo $url; ?>-<?php echo $item['id']; ?>.html"><img src="<?php echo base_url(); ?>uploads/hotel/<?php echo $item['hotel_thumb']; ?>" class="placeimg"/></a>
			</div>
			<div class="placer">
				<h3><a href="<?php echo base_url(); ?>hotel/<?php echo $url; ?>-<?php echo $item['id']; ?>.html"><?php echo CutStr($item['hotel_name'],23,false); ?></a></h3>
				<div class="hotstar">
					<div class="stars"><div class="star_active" style="width:<?php echo ($item['hotel_star']*12).'px'?>;"></div></div>
				</div>
				<div class="plainfo">
					<span><?php echo CutStr(strip_tags($item['hotel_title']),110); ?></span>
					<a href="<?php echo base_url(); ?>hotel/<?php echo $url; ?>-<?php echo $item['id']; ?>.html" class="red bold mgt5 fl">More details &raquo;</a>
				</div>
			</div>
		</div>
		<?php $i++; }}
		echo "<div class='cls'>";
		echo "<div class='pagina'>";
		echo $listpage;
		echo "</div>";
		echo "</div>";
		echo "</div>";
    }
    public function page_region() {
        $destina_id = $this->input->post('type');
        $start = $this->input->post('start');
        $limit = 8;
        $total = $this->model_region->count_region_d($destina_id);
        $pages = $this->pager->page($total,$limit);
        $listpage  = $this->pager->listpageregion($pages,$start,$limit,$destina_id);
        $place = $this->model_region->getRegionDes($destina_id, $limit, $start);
        echo "<div class='hotabc'>";
        if(isset($place)) {
            foreach($place as $item) { ?>
            <div class="places">
                <a href="<?php echo base_url(); ?>regions/<?php echo $item['region_rewrite']; ?>/<?php echo $item['region_id']; ?>.html"><img src="<?php echo base_url(); ?>uploads/regions/thumb/<?php echo $item['region_image']; ?>" class="placeimg" /></a>
                <h3><a href="<?php echo base_url(); ?>regions/<?php echo $item['region_rewrite']; ?>/<?php echo $item['region_id']; ?>.html"><?php echo $item['region_title']; ?></a></h3>
                <div class="plainfo">
                    <span class="fl"><?php echo CutStr(strip_tags($item['region_des']),80); ?></span>
                    <a href="<?php echo base_url(); ?>regions/<?php echo $item['region_rewrite']; ?>/<?php echo $item['region_id']; ?>.html" class="aplace">More details &raquo;</a>
                </div>
            </div>
        <?php }}
        echo "<div class='cls'>";
        echo "<div class='pagina'>";
        echo $listpage;
        echo "</div>";
        echo "</div>";
		echo "</div>";
    }
	public function page_region_hotel() {
        $destina_id = $this->input->post('des');
        $region_id = $this->input->post('region');
        $start = $this->input->post('start');
        $limit = 10;
        $total = $this->mhotel->countHotelRegion($destina_id, $region_id);
        $pages = $this->pager->page($total,$limit);
        $listpage  = $this->pager->listpage2($pages,$start,$limit,$destina_id,$region_id);
        $hotels = $this->mhotel->getHotelRegion($destina_id, $region_id,$start, $limit);
        echo "<div class='hotabc'>";
		if(isset($hotels)) {
		$i =0;
		foreach($hotels as $item) {
			$name = strtolower($item['hotel_name']);
			$name = str_replace("'","",$item['hotel_name'],$name);
			$name = str_replace("&",'',$item['hotel_name'],$name);
			$url = str_replace(' ', '-', $name);
			?>
		<div class="places mgbot15">
			<div class="placel">
				<a href="<?php echo base_url(); ?>hotel/<?php echo $url; ?>-<?php echo $item['id']; ?>.html"><img src="<?php echo base_url(); ?>uploads/hotel/<?php echo $item['hotel_thumb']; ?>" class="placeimg"/></a>
			</div>
			<div class="placer">
				<h3><a href="<?php echo base_url(); ?>hotel/<?php echo $url; ?>-<?php echo $item['id']; ?>.html"><?php echo CutStr($item['hotel_name'],23,false); ?></a></h3>
				<div class="hotstar">
					<div class="stars"><div class="star_active" style="width:<?php echo ($item['hotel_star']*12).'px'?>;"></div></div>
				</div>
				<div class="plainfo">
					<span><?php echo CutStr(strip_tags($item['hotel_title']),110); ?></span>
					<a href="<?php echo base_url(); ?>hotel/<?php echo $url; ?>-<?php echo $item['id']; ?>.html" class="red bold mgt5 fl">More details &raquo;</a>
				</div>
			</div>
		</div>
		<?php $i++; }}
		echo "<div class='cls'>";
		echo "<div class='pagina'>";
		echo $listpage;
		echo "</div>";
		echo "</div>";
		echo "</div>";
    }
    public function place() {
        $this->load->model('model_destina');
        $destina_id = $this->input->post('destina_id');
        $start = 0;
        $limit = 8;
        $total = $this->model_region->count_region_d($destina_id);
        $pages = $this->pager->page($total,$limit);
        $listpage  = $this->pager->listpageregion($pages,$start,$limit,$destina_id);
        $place = $this->model_region->getRegionDes($destina_id, $limit, $start);
		echo "<div class='hotabc'>";
        if(isset($place)) {
            foreach($place as $item) { ?>
            <div class="places">
                <a href="<?php echo base_url(); ?>regions/<?php echo $item['region_rewrite']; ?>/<?php echo $item['region_id']; ?>.html"><img src="<?php echo base_url(); ?>uploads/regions/thumb/<?php echo $item['region_image']; ?>" class="placeimg" /></a>
                <h3><a href="<?php echo base_url(); ?>regions/<?php echo $item['region_rewrite']; ?>/<?php echo $item['region_id']; ?>.html"><?php echo $item['region_title']; ?></a></h3>
                <div class="plainfo">
                    <span class="fl"><?php echo CutStr(strip_tags($item['region_des']),80); ?></span>
                    <a href="<?php echo base_url(); ?>regions/<?php echo $item['region_rewrite']; ?>/<?php echo $item['region_id']; ?>.html" class="aplace">More details &raquo;</a>
                </div>
            </div>
        <?php }}
        echo "<div class='cls'>";
        echo "<div class='pagina'>";
        echo $listpage;
        echo "</div>";
        echo "</div>";
		echo "</div>";
    }
    public function visa() {
        $this->load->model('model_destina');
        $destina_id = $this->input->post('destina_id');
        $visa = $this->model_destina->getdata($destina_id);
        echo "<div class='hotabc'>";
        echo "<div id='visahiden'>";
            echo CutStr($visa['destina_visa'],1000,true);
        echo "<a class='xanh' onclick='ashowvisa();' href='javascript:void(0)'> Read more</a>";
        echo "</div>";
        echo "</div>";
        echo "<div style='display: none;' id='visashow'>";
            echo $visa['destina_visa'];
        echo "</div>";
        echo "</div>";
    }
    public function fact() {
		if(!$_POST){die();}
        $destina_id = $this->input->post('destina_id');
        $result = $this->model_destina->getdata($destina_id);
		if($destina_id == 1){ 
			$dicode = "+84 - 4";
			$currency = "Vietnamese DONG (VND)";
			$region = "Ha Noi, Halong, ancestor worship and others";
		}elseif($destina_id == 2){
			$dicode = "+85 - 5";
			$currency = "Riel (KHR)";
			$region = "Buddhism, Christian, ancestor worship and others";
		}else{
			$dicode = "+85 - 6";
			$currency = "Kip (LAK)";
			$region = "Buddhism, Christian, ancestor worship and others";
		}
        echo "<div id='whento'>";
			echo '<h3 class="mgbot15">WHEN TO GO</h3>';
			echo "<img src='".base_url()."public/images/img_whentogo_03.jpg' width='176' height='126' alt='When to go' title='When to go' class='mgbot15' />";
			echo '<p class="mgbot15"><strong>Plug types</strong> : 2-pin outles, flat and round pins</p>';
			echo "<img src='".base_url()."public/images/plugtype_03.jpg' width='176' title='' alt='' />";
        echo "</div>";
		echo "<div id='areamap'>";
			echo "<h3 class='mgbot15'>AREA</h3>";
            echo "<img src='".base_url()."public/images/".$result['destina_maps']."' width='166' height='184' alt='".$result['destina_title']."' title=".$result['destina_title']." Map' />";
		echo "</div>";
		echo "<div id='zontime'>";
			echo "<h3>TIME ZONE</h3>";
			echo "<p>UTC +7</p>";
			echo "<h3>DIAL CODE</h3>";
			echo "<p>".$dicode."</p>";
			echo "<h3>CURRENCY</h3>";
			echo "<p>".$currency."</p>";
			echo "<h3>RELIGION</h3>";
			echo "<p>".$region."</p>";
		echo "</div>";
		echo "<div class='cls'></div>";
    }
    public function short_tour(){
        $destion = $this->input->post('destina');
        $type = $this->input->post('type');
        $tour = $this->input->post('tour');
        $start = 0;
        $limit = 7;
        if($tour == 0){
            $total = $this->model_destina->count_tour_sort($destion, $type);
            $pages = $this->pager->page($total,$limit);
            $listpage  = $this->pager->listpageall($pages,$start,$limit,$destion,$type);
            $listtours = $this->model_destina->get_tour_sort($destion, $type, $limit, $start);
            $this->list_tour($listtours, $listpage);
        }else{
            $total = $this->model_destina->count_dtt($destion, $type, $tour);
            $pages = $this->pager->page($total,$limit);
            $listpage  = $this->pager->listpageall($pages,$start,$limit,$destion,$type, $tour);
            $listtours = $this->model_destina->get_tour_by_dtt($destion, $type, $tour , $limit, $start);
            $this->list_tour($listtours, $listpage);
        }
    }
    public function short_tour2(){
        $destion = $this->input->post('destina');
        $region = $this->input->post('region');
        $type = $this->input->post('type');
        $tour = $this->input->post('tour');
        $start = 0;
        $limit = 7;
        if($tour == 0){
            $total = $this->model_tours->count_tour3($destion,$region, $type);
            $pages = $this->pager->page($total,$limit);
            $listpage  = $this->pager->listpage3($pages,$start,$limit,$destion,$region,$type);
            $listtours = $this->model_tours->get_tour3($destion,$region, $type, $limit, $start);
            $this->list_tour($listtours, $listpage);
        }else{
            $total = $this->model_tours->count_tour4($destion,$region, $type, $tour);
            $pages = $this->pager->page($total,$limit);
            $listpage  = $this->pager->listpage4($pages,$start,$limit,$destion,$region,$type, $tour);
            $listtours = $this->model_tours->get_tour4($destion,$region, $type, $tour , $limit, $start);
            $this->list_tour($listtours, $listpage);
        }
    }
    public function ajax_tour() {
        $destion = $this->input->post('destina');
        $type = $this->input->post('type');
        $start = $this->input->post('start');
        $limit = 7;
        $total = $this->model_destina->count_tour_sort($destion, $type);
        $pages = $this->pager->page($total,$limit);
        $listpage  = $this->pager->listpageall($pages,$start,$limit,$destion,$type);
        $listtours = $this->model_destina->get_tour_sort($destion, $type, $limit, $start);
        $this->list_tour($listtours, $listpage);
    }
    public function order_type(){
        $start = 0;
        $limit = 7;
        $type = $this->input->post('type');
        $ordert = $this->input->post('order');
        switch($ordert){
            case "1" : $order = "tours_price DESC"; break;
            case "2" : $order = "tours_price ASC"; break;
            case "3" : $order = "tours_star DESC"; break;
            case "4" : $order = "tours_star ASC "; break;
            default  : $order = "tours_star"; break;
        }
        $total = $this->model_destina->count_tour_type($type);
        $pages = $this->pager->page($total,$limit);
        $listpage  = $this->pager->listpagehotel($pages,$start,$limit,$type);
        $listtours = $this->model_destina->get_type_order($type,$order, $limit, $start);
		$this->load->view("public/cut_str");
        if(isset($listtours) && $listtours != NULL){
        foreach($listtours as $tours){ ?>
            <div class="tours">
                <div class="toursl">
                    <a href="<?php echo base_url()."tours/".$tours['tours_rewrite']."-".$tours['tours_id']; ?>.html"><img src="<?php echo base_url()."uploads/tours/thumb/".$tours['tours_image']; ?>" class="tourimg" alt="<?php echo $tours['tours_title']; ?>" title="<?php echo $tours['tours_title']; ?>" /></a>
                </div>
                <div class="toursr">
                    <h3><a href="<?php echo base_url()."tours/".$tours['tours_rewrite']."-".$tours['tours_id']; ?>.html" title="<?php echo $tours['tours_title']; ?>"><?php echo $tours['tours_title']; ?></a></h3>
                    <p class="tourp">Duration: <?php echo $tours['tours_type']; ?></p>
                    <p class="tourpri">Price from : <strong class="tourstr">$<?php echo $tours['tours_price']; ?></strong></p>
                    <p><span class="spangra">Grade : </span>
                    <?php
                    $typeimage = $this->mtype->get_data($tours['type_id']);
                    for($i=0; $i<$tours['tours_star']; $i++){
                    ?>
                        <img src="<?php echo base_url(); ?>uploads/holiday/<?php echo $typeimage['icon']; ?>" class="grare" alt="" />
                    <?php }?>
                    <?php for($j=0; $j<5-$i;$j++){ ?>
                        <img src="<?php echo base_url(); ?>uploads/holiday/<?php echo $typeimage['icon2'];?>" class="grare" alt="" />
                    <?php }?>
                    </p>
                    <div class="cls"></div>
                    <div class="tourino"><?php echo cut_str($tours['tours_short_info'],0,100); ?><br /><a class="acomment" href="<?php echo base_url()."tours/".$tours['tours_rewrite']."-".$tours['tours_id']; ?>.html">More Details ...</a></div>
                </div>
            </div>
            <div class="cls"></div>
        <?php } } ?>
        <?php
        echo '<div class="pagina">';
            echo $listpage;
        echo "</div>";
    }
    public function short_dura(){
        $type = $this->input->post('type');
        if($type == 0){
            $destion = $this->input->post('destina');
            $tour = $this->input->post('tour');
            $start = 0;
            $limit = 7;
            $total = $this->model_destina->count_dt($destion, $tour);
            $pages = $this->pager->page($total,$limit);
            $listpage  = $this->pager->listpageall($pages,$start,$limit,$tour,$type);
            $listtours = $this->model_destina->get_tour_by_dt($destion, $tour, $limit, $start);
            $this->list_tour($listtours, $listpage);
        }else{
            $destion = $this->input->post('destina');
            $tour = $this->input->post('tour');
            $start = 0;
            $limit = 7;
            $total = $this->model_destina->count_dtt($destion, $type, $tour);
            $pages = $this->pager->page($total,$limit);
            $listpage  = $this->pager->listpageall($pages,$start,$limit,$destion,$type, $tour);
            $listtours = $this->model_destina->get_tour_by_dtt($destion, $type, $tour , $limit, $start);
            $this->list_tour($listtours, $listpage);
        }
    }
    public function short_dura2(){
        $region = $this->input->post('region');
        $destion = $this->input->post('destina');
        $tour = $this->input->post('tour');
        $start = 0;
        $limit = 7;
        $type = $this->input->post('type');
        if($type == 0){
            $total = $this->model_tours->count_tour31($destion,$region, $tour);
            $pages = $this->pager->page($total,$limit);
            $listpage  = $this->pager->listpage3($pages,$start,$limit,$destion,$region,$tour);
            $listtours = $this->model_tours->get_tour31($destion,$region, $tour, $limit, $start);
            $this->list_tour($listtours, $listpage);
        }else{
            $total = $this->model_tours->count_tour4($destion,$region, $type, $tour);
            $pages = $this->pager->page($total,$limit);
            $listpage  = $this->pager->listpage4($pages,$start,$limit,$destion,$region,$type, $tour);
            $listtours = $this->model_tours->get_tour4($destion,$region, $type, $tour , $limit, $start);
            $this->list_tour($listtours, $listpage);
        }

    }
	public function add_date(){
		$startdate = $this->input->post('stardate');
        $date = $this->input->post('date');
		$date = $date - 1;
	    $cd = strtotime($startdate);
	    $retDAY = date('m/d/Y', mktime(0,0,0,date('m',$cd),date('d',$cd) + $date,date('Y',$cd)));
	    echo $retDAY;
	}
}
?>